<?php
/**
 * 评估管理
 */

class EstimateController extends Controller{
	public $Module = 'crm';
	public $Controller = 'Estimate';
	public $Action = 'index';
	public $UserConfig = array();

	public function IndexAction(){
	$this->Config = Config::GetConfig();
	$this->Assign('Config', $this->Config);
	$this->UserConfig = Cookie::GetMember('crm');
	$this->Assign('UserConfig', $this->UserConfig);
	if (empty($this->UserConfig['Id'])) {
		header('Location:/auth/login');
		exit();
	}
	$this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
	$this->SetView($this->Module . '/common');
	$this->AddView($this->Module . '/' . $this->Controller);
	$this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
}


//	public function AddAction(){
//		$this->Config = Config::GetConfig();
//		$this->Assign('Config', $this->Config);
//		$this->UserConfig = Cookie::GetMember('crm');
//		$this->Assign('UserConfig', $this->UserConfig);
//		if (empty($this->UserConfig['Id'])) {
//            header('Location:/auth/login');
//            exit();
//        }
//        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
//        $this->SetView($this->Module . '/common');
//        $this->AddView($this->Module . '/' . $this->Controller);
//        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
//	}


	public function EditAction(){
		$this->Config = Config::GetConfig();
		$this->Assign('Config', $this->Config);
		$this->UserConfig = Cookie::GetMember('crm');
		$this->Assign('UserConfig', $this->UserConfig);
		if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
	}


	public function SaveAction(){
		$this->Config = Config::GetConfig();
		$this->Assign('Config', $this->Config);
		$this->UserConfig = Cookie::GetMember('crm');
		$this->Assign('UserConfig', $this->UserConfig);
		if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, 'add');
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
	}


	public function UpdateAction(){
		$this->Config = Config::GetConfig();
		$this->Assign('Config', $this->Config);
		$this->UserConfig = Cookie::GetMember('crm');
		$this->Assign('UserConfig', $this->UserConfig);
		if (empty($this->UserConfig['Id'])){
			header('Location:/auth/login');
			exit();
		}
		$this->SetPurview($this->UserConfig, $this->Module, $this->Controller, 'edit');
		$this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
	}

	public function RemoveAction(){
		$this->Config = Config::GetConfig();
		$this->Assign('Config', $this->Config);
		$this->UserConfig = Cookie::GetMember('crm');
		$this->Assign('UserConfig', $this->UserConfig);
		if (empty($this->UserConfig['Id'])){
			header('Location:/auth/login');
			exit();
		}
		$this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
	}

}